Work with SAP structured parameters

When you work in integrated mode with SAP Solution manager, you can pass values from a Solution Manager test script to a GUI test, or vice versa, using the structure value type for your test parameters.

You create and maintain the structured parameters in SAP Solution Manager. After you have defined your test parameters via SAP Solution Manager you can map action parameters to the structured parameters in the test. When you run a test, UFT One receives the defined structure from SAP Solution Manager, and resolves the mapped local parameter with the actual structured parameter value from SAP Solution Manager.

Create or modify structured parameters

  1. From SAP Solution Manager, Launch your test as an external test.

    UFT One opens with your test displayed.

  2. In the Parameters tab of the Properties pane, click the Maintain SAP Parameters icon . If the Properties Pane is not already open, select View > Properties to open it.

    SAP Solutions Manager opens and UFT One is hidden.

    Note: SAP Structured Parameters can be maintained only in SAP Solution Manager.

  3. In SAP Solutions Manager, create or modify the structure parameters you want to use for your test, save your changes and click Back.

    UFT One re-opens with the changes you made now available.

Back to top

Assign or modify the structured parameters for an action

To use the SAP structured parameter to run the test, you must define parameters of type structure, associate the test and action parameters, and then map the action’s structured parameter to the test’s structured parameter. You can also map a simple type action parameter to a single element in a structured parameter defined for the test.

  1. Select the relevant action.

  2. In the Parameters tab of the Properties pane, you can add or remove parameters, as described in Add/Edit Parameter Dialog Box (Properties Pane - GUI Testing) in the UFT One User Guide. If the Properties Pane is not already open, select View > Properties to open it.

    Note: If the test contains structured parameters, you can add parameters with the structure type to the action.

  3. Map action parameters to the test structured parameters

    1. Right-click the relevant actions.

    2. In the context menu, select Action Call Properties.

    3. In the Action Call Properties Dialog Box > Parameter Values tab, in the Value cell/column of an input parameter or the Store In cell/column of an output parameter, click the Configure Value button.

    4. In either the Value Configuration Options Dialog Box (for input parameters) or the Storage Location Options Dialog Box (for output parameters), select the Parameter radio button and click Browse.

      The Value Map dialog box opens.

    5. Define the mapping, as described in Value Map Dialog Box.

      You can select the root node to map the entire structure, or a sub tree node to map to an embedded structure, or you can select a leaf node to map to a specific value in the structure.

    6. Click OK.

      The parameters are mapped

    Note: If an action is called inside another action, you can map a parameter to an input parameter of the parent action. If the action is called after another action, you can map a parameter to an output parameter of any previous action.

    For more details on test and action parameters, see Test and action parameters in the UFT One User Guide.

    Back to top

Use structured parameters in a script

The examples below show how you can use structured parameters directly from a script.

<?xml version="1.0" encoding="utf-16"?>
<ZMOVIE>
  <TITLE>Avatar</TITLE>
  <DIRECTOR>
    <FIRST_NAME>James</FIRST_NAME>
    <LAST_NAME>Cameron</LAST_NAME>
    <BIRTHDAY>16-8-1954</BIRTHDAY>
  </DIRECTOR>
  <REL_DATE>10-12-2009</REL_DATE>
  <GENRE>SF</GENRE>
  <STARRING>
    <item>
      <FIRST_NAME>Michelle</FIRST_NAME>
      <LAST_NAME>Rodriguez</LAST_NAME>
    </item>
    <item>
      <FIRST_NAME>Stephen</FIRST_NAME>
      <LAST_NAME>Lang</LAST_NAME>
    </item>
    <item>
      <FIRST_NAME>Zoe</FIRST_NAME>
      <LAST_NAME>Saldana</LAST_NAME>
    </item>
  </STARRING>
</ZMOVIE>
  • To access an element in a structured parameter, type the parameter name followed by a colon (:) and then the element path. Use a period (.) between elements and their sub-elements. For example:

    Print Parameter("Param1:ZMOVIE.DIRECTOR.FIRST_NAME")

    Output:

    James
    Print Parameter("Param1:ZMOVIE.STARRING.item[1].FIRST_NAME")

    Output:

    Michelle

    Note: UFT One provides statement completion for structured parameters, displaying the elements available for the relevant structure type.

  • If the path represents an element that contains additional sub-elements, the returned value will be a XML string. The path follows the XPath expression rule

    Print Parameter("Param1:ZMOVIE.DIRECTOR")

    Output:

    <DIRECTOR>
        <FIRST_NAME>James</FIRST_NAME>
        <LAST_NAME>Cameron</LAST_NAME>
        <BIRTHDAY>16-8-1954</BIRTHDAY>
      </DIRECTOR>
    
  • If the structure is an array or a table, you can use it in a loop:

    rowCount = Parameter("Param1:ZMOVIE.STARRING.item.count()")
    For Iterator = 1 To rowCount Step 1
        first_name = "Param1:ZMOVIE.STARRING.item[" & Iterator & "].FIRST_NAME"
        last_name = "Param1:ZMOVIE.STARRING.item[" &Iterator &"].LAST_NAME"
        print Parameter(first_name) & " " & Parameter(last_name)
    Next

    Output:

    Michelle Rodriguez
    Stephen Lang
    Zoe Saldana
    

Note: You can omit the root element from the path. For example,

Print Parameter("Param1:ZMOVIE.DIRECTOR.FIRST_NAME")

Can also be written as

Print Parameter("Param1:DIRECTOR.FIRST_NAME")

Back to top